package book;

public class PairOfUidAndBookId {
    private int userId;
    private int bookId;
    public PairOfUidAndBookId(){
    }

    public PairOfUidAndBookId(int userId, int bookId) {
        this.userId = userId;
        this.bookId = bookId;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public int getBookId() {
        return bookId;
    }

    public void setBookId(int bookId) {
        this.bookId = bookId;
    }
    //字符串转对象；(即，存储文件格式设置；);
    public String toJson(){
        StringBuilder json=new StringBuilder();
        json.append(userId).append(',');
        json.append(bookId);
        return json.toString();
    }

    @Override
    public String toString() {
        return "PairOfUidAndBookId{" +
                "userId=" + userId +
                ", bookId=" + bookId +
                '}';
    }

    public static void main(String[] args){
        PairOfUidAndBookId pairOfUidAndBookId=new PairOfUidAndBookId(1,2);
        System.out.println(pairOfUidAndBookId.toJson());
}
}
